import brewMethodsApi from "../api/brewMethods";

export const brewMethods={
    state:{
        brewMethods:[],
        brewMethodsLoadStatus:0,
    },
    actions:{
        loadBrewMethods({commit}){
            commit('setBrewMethodsLoadStatus',1);
            brewMethodsApi.getBrewMethods().then(function (response) {
                commit('setBrewMethodsLoadStatus',2);
                commit('setBrewMethods',response.data.data);
            }).catch(function () {
                commit('setBrewMethodsLoadStatus',3);
                commit('setBrewMethods',[]);
            });
        }
    },
    mutations:{
        setBrewMethodsLoadStatus:function (state,status) {
            state.brewMethodsLoadStatus = status;
        },
        setBrewMethods:function (state,brewMethods) {
            state.brewMethods = brewMethods;
        }
    },
    getters:{
        getBrewMethodsLoadStatus(state){
          return state.brewMethodsLoadStatus;
        },
        getBrewMethods(state){
            return state.brewMethods;
        }
    }

};
